package com.xy.learn.springboot.helloworld.controller;

import com.xy.starter.HelloService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author x
 */
@RestController
public class HelloWorldController {

    @Autowired
    HelloService helloService;

    Logger logger = LoggerFactory.getLogger(getClass());
    @GetMapping("/hello")
    public String hello() {
        logger.trace("这是trace日志");
        logger.debug("这是debug日志");
        logger.info("这是info日志");
        logger.warn("这是warn日志");
        logger.error("这是error日志");
        logger.error(helloService.sayHello("xy"));
        return "hello world";
    }
}
